﻿using markdown_picture_packer.common.constants;
using markdown_picture_packer.common.utils;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace markdown_picture_packer.frontend.panels
{
    public class ComboBoxPanel : BasePanel
    {
        private Label Lb;
        private ComboBox Cb;
        public ComboBoxPanel(string title, string[] dataSource)
        {
            Lb.Text = title;
            Cb.DataSource = dataSource;
        }
        public override void InitComponent()
        {
            Lb = new Label { Font = Constants.MAIN_FONT, ForeColor = Color.Blue, TextAlign = ContentAlignment.MiddleCenter };
            Cb = new ComboBox { Font = Constants.MAIN_FONT, DropDownStyle = ComboBoxStyle.DropDownList };
        }
        public override void InitSize(int newWdith, int newHeight)
        {
            Lb.Size = new Size(93, newHeight);
            Cb.Size = new Size(FrontUtil.GetFillWidth(newWdith, Lb), newHeight);
        }
        public override void InitLocation()
        {
            Lb.Location = new Point(0, 0);
            FrontUtil.OnRight(Cb, Lb, 0);
        }
        public override void AddComponent()
        {
            Controls.Add(Lb);
            Controls.Add(Cb);
        }
        public ComboBox GetComboBox()
        {
            return Cb;
        }
        public string GetText()
        {
            return Cb.Text;
        }
    }
}
